﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace nextwaver.utils
{
    sealed partial class WaitBoxForm : Form
    {
        public WaitBoxForm()
        {
            InitializeComponent();
        }
        public WaitBoxForm(string message)
        {
            Subject = "";
            DisplayText = message;
            InitializeComponent();
        }
        public WaitBoxForm(string subject, string message)
        {
            Subject = subject;
            DisplayText = message;
            InitializeComponent();
        }

        private string _subject;
        private string _message;

        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }

        public string Subject
        {
            get { return _subject; }
            set { _subject = value; }
        }

        public string DisplayText
        {
            get { return _message; }
            set { _message = value; }
        }

        private void ProgressMessage_Load(object sender, EventArgs e)
        {
            ProgressControls.ProgressIndicator progressIndicator = new ProgressControls.ProgressIndicator();
            progressIndicator.AutoStart = true;
            progressIndicator.Size = new Size(58,58);
            progressIndicator.Location = new Point(0,0);
            label1.Text = Subject;
            label2.Text = Message;
            panel1.Controls.Add(progressIndicator);
            Timer tim = new Timer();
            tim.Interval = 100; //refresh message every 0.1 s 
            tim.Tick += new EventHandler(tim_Tick);
            tim.Start();
        }

        void tim_Tick(object sender, EventArgs e)
        {
            label1.Text = Subject;
            label2.Text = DisplayText;
        }
    }
}
